Repository navigation
Fix compatibility with min()/max() macros - #399
Conversation
|
Good. |
fast_float 8.3.0 Created-by: HarmonybrewBot Commit-by: HarmonybrewBot Merged-by: HarmonybrewBot Description: Created by `brew bump` --- Created with `brew bump-formula-pr`.<details> <summary>release notes</summary> <pre>## What's Changed * New `chars_format::javascript` format ([ECMAScript DecimalLiteral](https://tc39.es/ecma262/#prod-DecimalLiteral)): like JSON, but the integer part may be empty (`.5`) and the fractional part may be empty (`5.`, `5.e3`); leading zeros, `inf` and `nan` are rejected. fastfloat/fast_float#407 * New `chars_format::javascript_sloppy` format: additionally accepts sloppy-mode `NonOctalDecimalIntegerLiteral` (`08.5` is 8.5). A legacy octal literal (`0775`) is rejected with the new `parse_error::legacy_octal_integer_part` so it can be parsed in base 8. * Faster integer-part scanning (4-digit SWAR on GCC) and skipping the rounding-mode probe for long mantissas by @fcostaoliveira in fastfloat/fast_float#398 * Avoid old-style casts by @lemire in fastfloat/fast_float#405 * Fix compatibility with `min()`/`max()` macros by @dg0yt in fastfloat/fast_float#399 * Guard `is_space` against negative signed code units by @sahvx655-wq in fastfloat/fast_float#395 * docs: fix strtod function name in README by @latent-9 in fastfloat/fast_float#404 **Full Changelog**: fastfloat/fast_float@v8.2.10...v8.3.0 </pre> <p>View the full release notes at <a href="https://github.com/fastfloat/fast_float/releases/tag/v8.3.0">https://github.com/fastfloat/fast_float/releases/tag/v8.3.0</a>.</p> </details> <hr> See merge request: Harmonybrew/homebrew-core!20258
|
Hmm, this is an incorrect fix for the C++ project, because you can simply define |
|
@IRainman We do not control how |
Yes, but it's not your problem. All Windows developers should know about this. Furthermore, you can add a static assert if min or max is defined. These macros broke so many things, so it's not needed as a crutch like this. |
|
In a flat world, it might be okay to go for "the user must know, the user must fix it." But the world of C++ isn't flat. fastfloat is a popular dependency in packages which are mixed in unforeseen ways. The user may not even know that he transitively includes fastfloat and windows.h. And every dependency in the chain may change the order of inclusion. A simple So this is the second best solution which can be done in a single place. The correct solution is to never put macros like min and max in a global namespace. But I wouldn't wait for windows.h to be fixed. |
windows.hmay define min() and max() macros. It is possible to guard against this on the consuming side. But this might get fragile with transitive dependencies. This PR suggests to avoid the problem in the headers.Noticed while updating vcpkg ports (breaking build of opencv4 and opencv3).